package com.itheima.mapper;

import com.itheima.pojo.Student;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface UserMapper {
    @Select("select * from t_user where username=#{username} and password=#{password}")
    Student loginUser(@Param("username")String username,@Param("password")String password);

    int addUser(Student student);

    @Delete("delete from t_user where id=#{id}")
    int delectUser(int id);

    int updateUser(Student student);

    @Select("select * from t_user")
    List<Student> findAll();

    @Select("select * from t_user where username like concat('%',#{username},'%') ")
    List<Student> findUserByName(String name);

    @Select("select * from t_user where id =#{id}")
    Student findUserById(int id);

}
